package com.xssweibo.ui;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class Main extends TabActivity {
	public TabHost mTabHost;
	public static final String TAB_HOME="TabHome";
	public static final String TAB_MSG="TabMsg";
	private RadioGroup mRadioGroup;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.maintabs);
		
		mTabHost = getTabHost();
		TabSpec ts1 = mTabHost.newTabSpec(TAB_HOME).setIndicator(TAB_HOME);
		ts1.setContent(new Intent(Main.this, Home.class));
		mTabHost.addTab(ts1);
		
		TabSpec ts2 = mTabHost.newTabSpec(TAB_MSG).setIndicator(TAB_MSG);
		ts2.setContent(new Intent(Main.this, UserMSG.class));
		mTabHost.addTab(ts2);
		
		mRadioGroup = (RadioGroup) findViewById(R.id.main_radio);
		mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// TODO Auto-generated method stub
				Log.d("select ID", "---------------"+checkedId);
				switch(checkedId)
				{
				case R.id.radio_button0://首页
					mTabHost.setCurrentTabByTag(TAB_HOME);
					 break;
				case R.id.radio_button1://信息
					mTabHost.setCurrentTabByTag(TAB_MSG);
					 break;
				case R.id.radio_button2://个人资料
				case R.id.radio_button3://搜索
				case R.id.radio_button4://更多	
				
				}				
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
}
